package com.my.test;

import java.util.Date;

import com.my.test.dao.UserDao;
import com.my.test.entiy.User;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
@MapperScan("com.my.test.dao")
public class Application  {

    @Autowired
    private UserDao userDao;

    @RequestMapping("/hello/{id}")
    @ResponseBody
    public User hello(@PathVariable("id") int id){
        User userInfo = userDao.findUser(1);
        return userInfo;
    }
    @RequestMapping("/add/{id}")
    @ResponseBody
    public User add(@PathVariable("id") int id){
        User userInfo = userDao.findUser(1);
        return userInfo;
    }

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
